package han.util;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

/**
 * @author: Han
 * @date: 2018/7/26 10:42
 * @dscription: 获取当前路径
 */
public class PathTool {

    private static Logger logger = LoggerFactory.getLogger(PathTool.class);

    public static String getPath() {
        String courseFile = "";
        try {
            File directory = new File("");
            courseFile = directory.getCanonicalPath();
        } catch (Exception e) {
            logger.info(e.toString());
            StackTraceElement[] stackTraceElements = e.getStackTrace();
            for (StackTraceElement stackTraceElement : stackTraceElements) {
                logger.error(stackTraceElement.toString());
            }
        }
        return courseFile;
    }

    public static String getCharset() {
        return System.getProperty("file.encoding");
    }
}
